#ifndef MONITORINGCHART_H
#define MONITORINGCHART_H

#include <QtWidgets/QGraphicsView>
#include <QtCharts/QChartGlobal>
#include <QtCharts/QChart>
#include <QtCharts/QLineSeries>
#include <QtCharts/QSplineSeries>
QT_BEGIN_NAMESPACE
class QGraphicsScene;
class QMouseEvent;
class QResizeEvent;
QT_END_NAMESPACE

QT_CHARTS_BEGIN_NAMESPACE
class QChart;
QT_CHARTS_END_NAMESPACE

class Callout;

QT_CHARTS_USE_NAMESPACE

class MonitoringChart : public QGraphicsView
{
public:
    MonitoringChart(QWidget *parent = 0);
    ~MonitoringChart();
    void sendChartData(int,int);
protected:
    void resizeEvent(QResizeEvent *event);
    void mouseMoveEvent(QMouseEvent *event);

public slots:
    void keepCallout();
    void tooltip(QPointF point, bool state);

private:
    QGraphicsSimpleTextItem *m_coordX;
    QGraphicsSimpleTextItem *m_coordY;
    QChart *m_chart;
    Callout *m_tooltip;
    QList<Callout *> m_callouts;
    QLineSeries *series;
    QLineSeries *series2;
    qreal m_currentX1; // 新增成员变量，记录当前 X 坐标
    qreal m_currentY1; //
    qreal m_currentX2; // 新增成员变量，记录当前 X 坐标
    qreal m_currentY2; //
};

#endif // MONITORINGCHART_H
